package san.entity.demo;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.Table;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.CollectionOfElements;

import com.dao.BaseEntity;

@Entity
@Table(name = "parser_news")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Parsernews extends BaseEntity {
	/**
	 * 表值集合的注释
	 */
	private static final long serialVersionUID = -6283328154125711946L;
	@Column(nullable = false, unique = true)
	private String url;// 网站URL
	private String urlname;// 网站名称
	private String regexurl;//正则表达式
	private String titletag;
	private String titleattribute;
	private String titleattributevalue;
	private String contenttag;
	private String contentattribute;
	private String contentattributevalue;
	private String datetag;
	private String dateattribute;
	private String dateattributevalue;
	private String authtag;
	private String authattribute;
	private String authattributevalue;

    @CollectionOfElements
    @JoinTable(
           name="newfilter",
           joinColumns = @JoinColumn(name="parser_id")
    )
    @Column(name="cutcontent", nullable=false)
	private Set<String> cutcontent;
	private String newstype;

	@Override
	public boolean equals(Object other) {
		if (!(other instanceof Parsernews))
			return false;
		Parsernews castOther = (Parsernews) other;
		return new EqualsBuilder().append(this.getId(), castOther.getId())
				.isEquals();
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder().append(getId()).toHashCode();
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this).append("id", getId()).toString();
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getUrlname() {
		return urlname;
	}

	public void setUrlname(String urlname) {
		this.urlname = urlname;
	}

	public String getRegexurl() {
		return regexurl;
	}

	public void setRegexurl(String regexurl) {
		this.regexurl = regexurl;
	}

	public String getTitletag() {
		return titletag;
	}

	public void setTitletag(String titletag) {
		this.titletag = titletag;
	}

	public String getTitleattribute() {
		return titleattribute;
	}

	public void setTitleattribute(String titleattribute) {
		this.titleattribute = titleattribute;
	}

	public String getTitleattributevalue() {
		return titleattributevalue;
	}

	public void setTitleattributevalue(String titleattributevalue) {
		this.titleattributevalue = titleattributevalue;
	}

	public String getContenttag() {
		return contenttag;
	}

	public void setContenttag(String contenttag) {
		this.contenttag = contenttag;
	}

	public String getContentattribute() {
		return contentattribute;
	}

	public void setContentattribute(String contentattribute) {
		this.contentattribute = contentattribute;
	}

	public String getContentattributevalue() {
		return contentattributevalue;
	}

	public void setContentattributevalue(String contentattributevalue) {
		this.contentattributevalue = contentattributevalue;
	}

	public String getDatetag() {
		return datetag;
	}

	public void setDatetag(String datetag) {
		this.datetag = datetag;
	}

	public String getDateattribute() {
		return dateattribute;
	}

	public void setDateattribute(String dateattribute) {
		this.dateattribute = dateattribute;
	}

	public String getDateattributevalue() {
		return dateattributevalue;
	}

	public void setDateattributevalue(String dateattributevalue) {
		this.dateattributevalue = dateattributevalue;
	}

	public String getAuthtag() {
		return authtag;
	}

	public void setAuthtag(String authtag) {
		this.authtag = authtag;
	}

	public String getAuthattribute() {
		return authattribute;
	}

	public void setAuthattribute(String authattribute) {
		this.authattribute = authattribute;
	}

	public String getAuthattributevalue() {
		return authattributevalue;
	}

	public void setAuthattributevalue(String authattributevalue) {
		this.authattributevalue = authattributevalue;
	}


	public Set<String> getCutcontent() {
		return cutcontent;
	}

	public void setCutcontent(Set<String> cutcontent) {
		this.cutcontent = cutcontent;
	}

	public String getNewstype() {
		return newstype;
	}

	public void setNewstype(String newstype) {
		this.newstype = newstype;
	}
}
